package org.ly817.falsework.dubbo.service.boot.service;

import com.alibaba.dubbo.config.annotation.Service;
import org.ly817.falsework.api.entity.User;
import org.ly817.falsework.api.service.UserService;
import org.ly817.falsework.dubbo.service.boot.dao.UserDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author LuoYu
 * @date 2018/07/26 10:38
 * <p>
 * Description:
 * user服务接口实现
 */
@Component("userService")
@Service(timeout = 5000)
public class UserServiceImpl implements UserService {

    private final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);

    @Autowired
    private UserDao userDao;

    @Override
    public boolean add(User user) {
        return false;
    }

    @Override
    public User test(User user) {
        logger.error("调用dubbo测试方法");
        user = userDao.getUserById(1);
        user.setName(user.getName() + "ojbk");
        return user;
    }
}
